package spring.controller.converter;

import org.springframework.core.convert.converter.Converter;
import spring.model.Persistivel;
import spring.service.BaseService;


public abstract class StringEntity<T extends Persistivel> implements Converter<String, T> {

	protected T convert(String s, BaseService<T> service) {
		return s.isEmpty() ? null : service.findById(Long.parseLong(s));
	}
}
